#include <stdio.h>
#include <string.h>

static int is_subsequence(const char *small, const char *big)
{
    while (*small && *big)
    {
        if (*small == *big)
            ++small;
        ++big;
    }
    return (*small == '\0');
}

static void reverse(char *s)
{
    char *p = s + strlen(s) - 1;
    for (; s < p; s++, p--)
    {
        char c = *s;
        *s = *p;
        *p = c;
    }
}

int main()
{
    int T, t;
    scanf("%d", &T);
    for (t = 0; t < T; t++)
    {
        char big[120], small[120];
        scanf("%s %s", big, small);
        if (is_subsequence(small, big))
        {
            printf("YES\n");
            continue;
        }
        reverse(small);
        if (is_subsequence(small, big))
        {
            printf("YES\n");
            continue;
        }
        printf("NO\n");
    }
    return 0;
}
